package com.ruoyi.wx.mapper;

import com.ruoyi.wx.entity.PtTeacherClass;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 教师管理班级对应表 Mapper 接口
 * </p>
 *
 * @author moxiu
 * @since 2022-03-06
 */
public interface PtTeacherClassMapper extends BaseMapper<PtTeacherClass> {

    /**
     * 根据教师id 获取班级id数组
     * @param teacherId 教师id
     * @return 数组
     */
    List<Long> getMyClassId(@Param("teacherId") long teacherId);

    /**
     * 获取这个班级对应的老师
     * @param deptId 班级id
     * @return 老师id
     */
    @Select("select ptc.teacher_id from pt_teacher_class ptc\n" +
        "WHERE ptc.dept_id = #{deptId}\n" +
        "ORDER BY ptc.id\n" +
        "LIMIT 0,1")
    Long getTeacherId(@Param("deptId")Long deptId);

}
